package com.meelive.ingkee.iknetwork.diagnose.util

import com.inke.inkenetinspector.InkeNetInspector
import com.meelive.ingkee.base.utils.guava.Preconditions
import com.meelive.ingkee.iknetwork.diagnose.model.IKNetworkDiagnoseConfig
import java.util.*

object InKeNetInspectorUtil {

    fun pingDomain(inkeNetInspector: InkeNetInspector, hosts: ArrayList<String>?, pingTimes: Int, pingInterval: Int) {
        Preconditions.checkArgument(pingInterval > 0)
        inkeNetInspector.ping(hosts, pingTimes, pingInterval)
    }

    fun httpDownload(inkeNetInspector: InkeNetInspector, httpList: IKNetworkDiagnoseConfig.HttpList) {
        inkeNetInspector.httpDownload(httpList.url, httpList.max_speed, httpList.max_data_size, httpList.max_duration)
    }

    fun calculateCpuFreq(inkeNetInspector: InkeNetInspector) {
        inkeNetInspector.calculateCpuFreq()
    }

    fun httpStartNICSpeedMonitor(inkeNetInspector: InkeNetInspector) {
        inkeNetInspector.startNICSpeedMonitor()
    }

    fun httpStopNICSpeedMonitor(inkeNetInspector: InkeNetInspector) {
        inkeNetInspector.stopNICSpeedMonitor()
    }
}